package com.sc.order.controller;

import com.sc.common.pojo.CommonResult;
import com.sc.order.pojo.OrderInfo;
import com.sc.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @auther sc
 * @Date 2017/11/7
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;


    @RequestMapping(value = "/create",method = RequestMethod.POST)
    @ResponseBody
    public CommonResult createOrder(@RequestBody OrderInfo orderInfo){
        try {
            return orderService.createOrder(orderInfo);
        } catch (Exception e) {
            return CommonResult.build(500,"创建订单失败");
        }
    }


}
